home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / ARexx / 03 / 15.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-08-14  |  4.4 KB  |  234 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. PicAName = strip(line)
  22. line = readln(TempFile)
  23. Start = strip(line)
  24. line = readln(TempFile)
  25. End = strip(line)
  26. line = readln(TempFile)
  27. IAType = strip(line)
  28.  
  29. line = readln(TempFile)
  30. Answer = strip(line)
  31. line = readln(TempFile)
  32. Answer2X = strip(line)
  33. line = readln(TempFile)
  34. Answer2Y = strip(line)
  35. line = readln(TempFile)
  36. Answer3 = strip(line)
  37. line = readln(TempFile)
  38. Answer4 = strip(line)
  39. line = readln(TempFile)
  40. PathType = strip(line)
  41. line = readln(TempFile)
  42. AnswerMove = strip(line)
  43.  
  44. call close TempFile
  45.  
  46. Frames = (End - Start)+1
  47. j=0
  48. k=0
  49. TFrames = Frames
  50. TNum = 3
  51. if TFrames > 999 then TNum = 4
  52. if TFrames > 9999 then TNum = 5
  53. if Field = 1 then TFrames = Frames*2
  54. do i = Start to End
  55.     k = k+ 1
  56.     call open TempFile,"RAM:VFXNums",W
  57.     call writeln TempFile,right(k,5,'0')
  58.     call writeln TempFile,right(Frames,5,'0')
  59.     call close TempFile
  60.     f=0
  61.     Redraw Off
  62.     j = j+ 1
  63.     FieldSet = 0
  64.     call DoIt()
  65.     Redraw On
  66.     call SaveIt()
  67.         if Field = 1 then do
  68.             Redraw Off
  69.             j = j + 1
  70.             FieldSet = 1
  71.             call DoIt()
  72.             Redraw On
  73.             call SaveIt()
  74.             end 
  75.     end
  76.     Undo On
  77. exit
  78.  
  79.  
  80.  
  81. LoadA:
  82.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  83.         Undo On
  84.         exit
  85.         end
  86.     if IAType = 0 then do
  87.         LoadBuffer PicAName Force i
  88.         if Field = 1 then do
  89.             GetMain
  90.             parse var result Name Width Height Blah
  91.             if FieldSet = 0 then do
  92.                 Hook DeInterlace
  93.                 Scale Width Height
  94.                 end
  95.             if FieldSet = 1 then do
  96.                 Hook DeInterlace
  97.                 Swap
  98.                 Scale Width Height
  99.                 end
  100.             end
  101.         end
  102.     if IAType = 1 then do
  103.         LoadBuffer PicAName Force 1
  104.         end
  105.     if IAType = 2 then do
  106.         LoadBuffer PicAName Force
  107.         end
  108.     if IAType = 3 then do
  109.         LoadBuffer PicAName""right(i,TNum,'0') Force
  110.         end
  111. return
  112.  
  113.  
  114. GetPathCords:
  115.     PathFile = "VFXIFX:TempDrawer/DrawNum."FXNum
  116.     PathNum = trunc(((j-1) * AnswerMove)/(TFrames-1))
  117.     if PathNum < 1 then PathNum = 1
  118.     call open TempFile,PathFile,R
  119.     do ii = 1 to PathNum
  120.         line = readln(TempFile)
  121.         end
  122.     parse var line MyX" "MyY
  123.     call close TempFile
  124. return
  125.  
  126. GetXYCords:
  127.     FrameNum = j
  128.     TotalNum = TFrames
  129.  
  130.     TotalKey = 1
  131.     NumKey = (TotalNum/TotalKey)
  132.     FirstNum = ((NumKey - (NumKey-(FrameNum-1)))%NumKey)+1
  133.     SecNum = FirstNum+1
  134.     if FirstNum = TotalKey then do
  135.         NumKey = NumKey - 1
  136.         NewNum = (((FrameNum-((FirstNum-1)*NumKey)))-(TotalKey-1))
  137.         end
  138.     else 
  139.         NewNum = ((FrameNum-((FirstNum-1)*NumKey)))
  140.     if X2 < X1 then do
  141.         DiffX = -((X1-X2)/(NumKey))
  142.         end
  143.     else do
  144.         DiffX = ((X2-X1)/(NumKey))
  145.         end
  146.     if Y2 < Y1 then do
  147.         DiffY = -((Y1-Y2)/(NumKey))
  148.         end
  149.     else do
  150.         DiffY = ((Y2-Y1)/(NumKey))
  151.         end
  152.     MyX = (X1 + (DiffX*NewNum))-DiffX
  153.     MyY = (Y1 + (DiffY*NewNum))-DiffY
  154.     MyX = MyX % 1
  155.     MyY = MyY % 1
  156. return
  157.  
  158. SaveIt:
  159.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  160.         Undo On
  161.         exit
  162.         end
  163.     if SaveType = 0 then do
  164.         call Switcher(TOSW)
  165.         call Switcher(MDV1)
  166.  
  167.         Render Go
  168.         if Field = 1 then
  169.                 call RecordAdd(SaveName,1,6,Compression)
  170.         else
  171.                 call RecordAdd(SaveName,2,6,Compression)
  172.         if j = TFrames then
  173.             call MakeIcon(SaveName,(Frames-10))
  174.         end
  175.  
  176.     if SaveType = 1 then do
  177.         if Field = 1 then do
  178.             f= f + 1
  179.             if f = 1 then
  180.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  181.             if f = 2 then do
  182.                 GetMain
  183.                 parse var result Name Width Height Blah
  184.                 Scale Width Height/2
  185.                 Swap
  186.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  187.                 Scale Width Height/2
  188.                 Hook Interlace
  189.                 SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  190.                 f = 0
  191.                 end
  192.             end
  193.         else do
  194.             SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  195.             end    
  196.         end
  197.  
  198.  
  199. return
  200.  
  201.  
  202. DoIt:
  203.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  204.         Undo On
  205.         exit
  206.         end
  207.     call LoadA()
  208.     DrawMode Normal
  209.     ActiveColor 1
  210.     GetMain
  211.     parse var result Name Width Height Blah
  212.     if PathType = 0 then call GetXYCords()
  213.     if PathType = 1 then call GetPathCords()
  214.     Buffer2Swap
  215.     ClearBuffer Force 0 0 0
  216.     AlphaChannel Off
  217.     EdgeMode FeatherOut Answer3
  218.     FilledOval MyX MyY Answer2X Answer2Y
  219.     if Answer4 = 2 then
  220.         FilledOval Width-MyX MyY Answer2X Answer2Y
  221.     EdgeMode Normal
  222.     Buffer2Alpha
  223.     Swap
  224.     Buffer2Swap
  225.     Brightness Answer
  226.     AlphaChannel FRISKET
  227.     Merge 100 Alpha
  228.     KillAlpha
  229.  
  230. return
  231.  
  232.  
  233.  
  234.